******************************
*Table 8:  Heterogeneous effects by gender and baseline anemic status
************************
clear all
set trace off
set more off
clear
use Jehanabad_analytic_sample_hemoglobin

global socio_cov_1_vari no_HHmembers years_schooling_father years_schooling_mother asset_index
global school_cov_4_vari total_enrollment class_size student_teacher_ratio

g post=wave
label var post "Post"  /* Post denotes endline survey */
g treat_post=treat*post
label var treat_post "Treat*post"

sort child_unique wave
g base_hb=hemoglobin
replace base_hb=hemoglobin[_n-1] if wave==1
g bl_anemic= base_hb < 11.5
g bl_severe_an=(base_hb < 11)
g non_anemic =(base_hb >=11.5)


**Panel A 
eststo clear
foreach var in hemoglobin any_an mild_an mod_sev_an{
xtset child_unique wave
eststo: xtreg `var' treat_post treat post $socio_cov_1_vari $school_cov_4_vari if sex_child==0, fe cluster (school_id)
}
esttab using Table8_panel_A.rtf, se(a3) keep(treat_post) varwidth(35) b(a3) star(* 0.10 ** 0.05 *** 0.01) replace ///
title(Table 8:  Heterogeneous effects by gender and baseline anemic status)  mtitles("Hemoglobin (Hb g/dL)" "Any anemia" "Mild anemia" "Moderate or severe anemia" ) /// 
coeflabels(treat_post "Treat*post") nonotes label 

eststo clear
foreach var in hemoglobin any_an mild_an mod_sev_an{
xtset child_unique wave
eststo: xtreg `var' treat_post treat post $socio_cov_1_vari $school_cov_4_vari if sex_child==1, fe cluster (school_id)
}
esttab using Table8_panel_A.rtf, se(a3) keep(treat_post) varwidth(35) b(a3) star(* 0.10 ** 0.05 *** 0.01) append ///
mtitles("Hemoglobin (Hb g/dL)" "Any anemia" "Mild anemia" "Moderate or severe anemia" ) /// 
coeflabels(treat_post "Treat*post") nonotes label 


** Panel B
eststo clear
foreach var in hemoglobin any_an mild_an mod_sev_an{
xtset child_unique wave
eststo: xtreg `var' treat_post treat post $socio_cov_1_vari $school_cov_4_vari if bl_anemic==1, fe cluster (school_id)
}
esttab using Table8_panel_A.rtf, se(a3) keep(treat_post) varwidth(35) b(a3) star(* 0.10 ** 0.05 *** 0.01) append ///
title(Table 8:  Heterogeneous effects by gender and baseline anemic status)  mtitles("Hemoglobin (Hb g/dL)" "Any anemia" "Mild anemia" "Moderate or severe anemia" ) /// 
coeflabels(treat_post "Treat*post") nonotes label 

eststo clear
foreach var in hemoglobin any_an mild_an mod_sev_an{
xtset child_unique wave
eststo: xtreg `var' treat_post treat post $socio_cov_1_vari $school_cov_4_vari if bl_severe_an==1, fe cluster (school_id)
}
esttab using Table8_panel_A.rtf, se(a3) keep(treat_post) varwidth(35) b(a3) star(* 0.10 ** 0.05 *** 0.01) append ///
mtitles("Hemoglobin (Hb g/dL)" "Any anemia" "Mild anemia" "Moderate or severe anemia" ) /// 
coeflabels(treat_post "Treat*post") nonotes label 

eststo clear
foreach var in hemoglobin any_an mild_an mod_sev_an{
xtset child_unique wave
eststo: xtreg `var' treat_post treat post $socio_cov_1_vari $school_cov_4_vari if non_anemic==1, fe cluster (school_id)
}
esttab using Table8_panel_A.rtf, se(a3) keep(treat_post) varwidth(35) b(a3) star(* 0.10 ** 0.05 *** 0.01) append ///
mtitles("Hemoglobin (Hb g/dL)" "Any anemia" "Mild anemia" "Moderate or severe anemia" ) /// 
coeflabels(treat_post "Treat*post") nonotes label ///
addnotes("Notes: Standard errors, clustered at the school level, are reported in parentheses. Each cell reports the"  ///
"DD coefficient from a separate regression. All regressions include child fixed effects and time-variant household & " ///
"school-level controls reported in Table 4. Any anemia is defined as a hemoglobin value < 11.5 g/dl, mild anemia is defined" ///
"as a hemoglobin value ≥ 11 & < 11.5 g/dl, moderate/severe anemia is defined as a hemoglobin value < 11 g/dl." ///
"*, **, *** denote significance at the 10%, 5%, and 1% levels, respectively.") 



********************************************End of do file *******************


